package com.heima.schedule.feign;

import com.heima.leadnews.schedule.IScheduleClient;
import com.heima.model.schedule.dtos.Task;
import com.heima.schedule.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class ScheduleClient implements IScheduleClient {
    @Autowired
    TaskService taskService;
    @Override
    @PostMapping("/api/v1/task/add")

    public long addTask(@RequestBody Task task) {

    return taskService.addTask(task);
    }

    @Override
    @GetMapping("/api/v1/task/poll/{type}/{priority}")
    public Task poll(@PathVariable("type") int type, @PathVariable("priority")  int priority){
       return taskService.poll(type, priority);
    }
}
